package com.mcy.springbatch.processer;

import com.mcy.springbatch.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.stereotype.Component;

/**
 * 模拟业务抛出错误
 * @author : Create By mcy
 * @date : 2019/8/25 22:46:21
 */
@Slf4j
@Component
public class SysUserItemProcessor implements ItemProcessor<SysUser,SysUser> {

    @Override
    public SysUser process(SysUser item) throws Exception {
        log.info("正在处理：{}", item.toString());
        if (item.getId() > 5 && item.getId() < 10) {
            throw new RuntimeException("人为抛出错误");
        }
        return item;
    }
}
